package com.yhally.seata.order.feign;

import com.yhally.seata.common.domain.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 *
 * @author wangyu
 * @version 1.0
 * @date 2022/5/6 23:00
 */
@FeignClient(value = "seata-storage")
@RequestMapping("/storage")
public interface StorageService {

    /**
     * <p>描述: AT 扣减库存
     * <p>开发者: wangyu
     * <p>时间: 2022/5/8 22:35
     *
     * @param productId
     * @param count
     * @return CommonResult
     */
    @PostMapping("/decrease")
    CommonResult decrease(@RequestParam("productId") Long productId,
                          @RequestParam("count") Integer count);

    /**
     * <p>描述: TCC 扣减库存
     * <p>开发者: wangyu
     * <p>时间: 2022/5/8 22:34
     *
     * @param productId
     * @param count
     * @return CommonResult
     */
    @PostMapping("/decreaseByTcc")
    CommonResult decreaseByTcc(@RequestParam("productId") Long productId,
                          @RequestParam("count") Integer count);
}
